#define NDEBUG
#include <cstring>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <limits>

#define NV(v)#v<<" : "<<(v)
#ifdef NDEBUG
    #define DEBUG(code)
#else
    #define DEBUG(code){code}
#endif
using ll = long long;


#ifdef NDEBUG
    auto &is = std::cin;
#else
    auto is = std::ifstream("/root/dev/cpp/algorithm_2024/src/P3957/P3957_9.in");
#endif
auto &os = std::cout;

const ll max_n = 5e5+5, ll_min{std::numeric_limits<decltype(ll_min)>::min()}, 
                ll_max{std::numeric_limits<decltype(ll_max)>::max()};
ll n, d, k;
struct Point{
    ll posit,score;
}points[max_n];
ll dp[max_n];

void flush_exit(){
    os<<std::flush;
    _Exit(0);
}

bool check(const ll coin){
    for(ll i{0};i<max_n;i++)dp[i]=ll_min;
    dp[0]=0; // 注意第0个点是能到达的reachable
    const ll max_step {coin+d}, min_step {std::max((ll)1,d-coin)};
    for(ll i{1};i<=n;++i){
        for(ll from{i-1};from>=0;from--){
            ll dis{points[i].posit-points[from].posit};
            if(min_step<=dis){
                if(dis<=max_step){
                    if(dp[from]==ll_min)continue;
                    dp[i] = std::max(dp[i],dp[from]+points[i].score);
                    if(dp[i]>=k){
                        return true;
                    }
                }else{
                    break;
                }
            }
        }
    }
    return false;
}

int main(){
    is>>n>>d>>k;
    for(ll i{1};i<=n;++i){
        is>>points[i].posit>>points[i].score;
    }
    
    // const ll max_coin{(ll)1e9+5};//d+g = x[n] -> g = x[n]-d我的推导是这样的，但是错了，必须将max_coin设置为1e5+5也就是s[i]最大值，会TLE最终研究了一下应该是作者卡时间
    const ll max_coin{std::min(std::max(d-1,points[n].posit-d),(ll)1e4)};//d+g = x[n] -> g = x[n]-d我的推导是这样的，但是错了，必须将max_coin设置为1e5+5也就是s[i]最大值，会TLE最终研究了一下应该是作者卡时间
    ll l{0},r{max_coin},ans{ll_max};
    while(l<=r){
        ll mid{(l+r)/2};
        const bool check_ret{check(mid)};
        if(check_ret){
            ans = mid;
            r=mid-1;
        }else{
            l=mid+1;
        }
        DEBUG(
            os<<NV(l)<<"\t"<<NV(r)<<'\n';
        )
    }

    os<<(ans==ll_max?-1:ans)<<'\n';
}
